using System;
using Microsoft.AspNetCore.Mvc;
using ApiProject.Api.Entity;
using System.Linq;
using ApiProject.Api.Repository;
using Microsoft.AspNetCore.Hosting;
using ApiProject.Api.Uitls;
using ApiProject.Api.Utils;
using ApiProject.Api.PramaModel;


// 轮播图管理
namespace ApiProject.Api.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class FrontController : ControllerBase
    {
        //广告轮播图
        private IRepository<AdImage> _adImage;

        public FrontController( IRepository<AdImage> adImage)
        {
            _adImage = adImage;

        }


         //获取所有的轮播图
        //Get /front/pic
        [HttpGet,Route("pic")]
        public dynamic GetPicture()
        {
            var allpic = _adImage.Table.Where(x => x.IsDelete == false && x.IsEnable == true).ToList();

            return JsonHelper.Serialize(new
            {
                Code = 200,
                Data = allpic
            });
        }


 



    }
    
}